package com.xiaotu.server.service.relation;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaotu.common.model.TVDataSourceRelatetionModel;
import com.xiaotu.server.service.BaseService;
import com.xiaotu.server.service.maoyan.CheckMovieService;

@Service
public class TVDataSourceRelationService extends BaseService {

	@Autowired
	private CheckMovieService checkMovieService;
	
	@Override
	protected String getKey() {
		return "TVDataSourceRelationMapper";
	}

	
	//保存骨朵和猫眼剧关系
	public int saveTVDataSourceRelation(TVDataSourceRelatetionModel obj) {
		return this.save("saveTVDataSourceRelation", obj);
	}

	//查询单条记录
	public TVDataSourceRelatetionModel queryTvDataSourceRelation(Map<String, Object> extrasMap) {
		return this.get("queryTvDataSourceRelation",extrasMap);
	}

	//修改
	public int updateTVDataSourceRelation(TVDataSourceRelatetionModel obj) {
		return this.update("updateTVDataSourceRelation", obj);
	}

	//更新猫眼最新数据id
	public void updateMaoYanDataId(Map<String, Object> extrasMap) {
		//更新剧数据源中间表最新的猫眼dataid
		this.update("updateMaoYanDataId", extrasMap);
		//更新检查表状态为1
		checkMovieService.updateSupplement(extrasMap);
		//删除艺人作品中间表
		checkMovieService.deleteStarWorksSupplement(extrasMap);
		//删除公司作品中间表
		checkMovieService.deleteCompanyWorksSupplement(extrasMap);
		//删除猫眼基本信息
		checkMovieService.deleteMovieBasicInfo(extrasMap);
	}
	
	
}
